#pragma once

class  CAsyncTaskBase
{
public:
	CAsyncTaskBase(){};

	virtual void run() = NULL;
	virtual void finished(){};
	virtual void canceled(){};
	virtual void release()
	{
		delete this;
	}

protected:
	virtual ~CAsyncTaskBase() {};
};

class CThreadPool
{
private:
	CThreadPool();
	~CThreadPool();

public:
	static bool init();
	static void terminate();

	static bool addTask(CAsyncTaskBase *task, int delay = 0);
	static bool addQueuedTask(const char *queueName, CAsyncTaskBase *task);
};
